package com.subfg.common.util.auth;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class GenerateId {
    @Value("${workerId}")
    private long workerId;
    @Autowired
    SnowFlake snowFlake;
    public GenerateId(){
        snowFlake = new SnowFlake(workerId);
    }
    //测试支付渠道号
    public String generatePayNo(){ return "TP"+snowFlake.nextId();}
    //生成用户Id
    public String generateUserId(){ return  "UI"+snowFlake.nextId(); }
    //生成车队Id编号
    public String generateFamilyGroupId(){ return "FG"+snowFlake.nextId();}
    //生成订单编号
    public String generateOrderNo(){
        return "ON"+snowFlake.nextId();
    }
    //合并订单编号
    public String generateMergeNo() { return "MO" + snowFlake.nextId();}
    //生成退款编号
    public String genrateRefundNo(){return "RF"+snowFlake.nextId();}
    //生成提现编号
    public String genrateWithdrawNo(){return "WD"+snowFlake.nextId();}
    //成员进入家庭进入家庭组生成成员id
    public String genrateMenberId(){return "MI"+snowFlake.nextId();}
    //生成三方产品id
    public String genrateProductId(){return "3PI" + snowFlake.nextId();}
    //三方套餐
    public String genrateProductPlanId(){return "3PL" + snowFlake.nextId();}
    //生成自定义订阅编号
    public String genrateSubscription(){return "SM"+snowFlake.nextId();}
    //生成用户账号
    public String genrateAccount(){return snowFlake.generateId().toString();}
    //生成收藏id
    public String genrateFavorite(){return "FC"+snowFlake.nextId();}
    // 生成MQ队列id
    public String genrateMqId() {return "MQ" + snowFlake.nextId();
    }
    public String gerateCommonId() {return "CM" + snowFlake.nextId();}
}
